#include "qscriptparaminfowidget.h"

#include "qproperty.h"

#include "../../lib/corelib/qscriptparameter.h"

#include <QPalette>

QScriptParamInfoWidget::QScriptParamInfoWidget(QProperty *property, QWidget *parent):
    QLabel(parent),
    m_property(property)
{
    setMinimumWidth(100);

    QString userKey=m_property->attribute("param").toString();
    tagScriptFuncInfo info=QScriptParameter::funcInfo(userKey);

    if(info.m_userID==userKey)
    {
        QString str;
        foreach(tagScriptParaInfo in,info.m_para)
        {
            str+=QString("%1:%2").arg(in.m_name).arg(in.m_type);
            if(in.m_info!="")
            {
                str+=QString("(%1)").arg(in.m_info);
            }
            str+="  ";
        }

        setText(str);
        setToolTip(str);

        QPalette p=this->palette();
        p.setColor(QPalette::Normal,QPalette::WindowText,Qt::white);
        this->setPalette(p);
    }
}
